<?php
// +----------------------------------------------------------------------
// | author: thinkphp
// +----------------------------------------------------------------------

namespace app\common\enum;


/**
 * 订单类型
 * Class OrderTypeEnum
 * @package app\common\enum
 */
class OrderEnum
{

    // 订单类型
    const LINE_ORDER = 1;     // 包车游订单
    const AIRPORT_TRANSFER = 2;     // 接送机订单
    const SHOP_ORDER = 3;    // 商品订单


    /**
     * 获取订单类型描述
     * @param int $type
     * @return string
     */
    public static function getTypeDesc(int $type): string
    {
        $map = [
            self::LINE_ORDER => '包车游订单',
            self::AIRPORT_TRANSFER => '接送机订单',
            self::SHOP_ORDER => '商品订单'
        ];

        return $map[$type] ?? '未知订单类型';
    }

    // 订单状态
    const ORDER_AFTER_SALE = -1; //售后
    const ORDER_WAIT_PAY = 0; // 待支付
    const ORDER_WAIT_TRAVEL = 1; // 待出行   已付款
    const ORDER_WAIT_DRIVER = 2; //司机已接单
    const ORDER_TRAVELING = 3; //行程中
    const ORDER_WAIT_COMMENT = 4;//待评价
    const ORDER_COMPLETE = 5; //已完成
    const ORDER_CANCEL = 6; //取消

    public static function getStatusDesc(int $status): string
    {
        $map = [
            self::ORDER_WAIT_PAY => '待支付',
            self::ORDER_WAIT_TRAVEL => '待出行',
            self::ORDER_WAIT_DRIVER => '司机已接单',
            self::ORDER_TRAVELING => '行程中',
            self::ORDER_WAIT_COMMENT => '待评价',
            self::ORDER_COMPLETE => '已完成',
            self::ORDER_CANCEL => '取消',
        ];

        return $map[$status] ?? '未知订单状态';
    }

}